<template>
  <form action="/login" method="post">
    <label>
      用户名：<input type="text" name="username">
    </label>
    <br />
    <label>
      密码：<input type="password" name="password">
    </label>
    <button type="submit">登录</button>
  </form>
  <br />
  <br />
  <br />
  <form action="/user" method="post">
    <label>
      用户名：<input type="text" name="username">
    </label>
    <br />
    <label>
      密码：<input type="password" name="password">
    </label>
    <button type="submit">注册</button>
  </form>
  <br />
  <br />
  <br />
  <a href="http://localhost:8080/logout">
    退出
  </a>
  <br />
  <br />
  <br />
  <a href="http://localhost:8080/oauth2/authorization/gitee">
    gitee登录
  </a>
  <br />
  <br />
  <br />
  <a href="http://localhost:8080/oauth2/authorization/github">
    github登录
  </a>
</template>

<script setup>
import { reactive, ref, getCurrentInstance } from 'vue';

const user = reactive({
  username: '',
  password: '',
})

const { proxy } = getCurrentInstance()
const baseURL = "http://localhost:8080"
const loginFunc = function () {
  proxy.$axios.post(baseURL + '/login?username=' + user.username + '&&password=' + user.password)
    // proxy.$axios.post(baseURL + '/login?', user)
    .then(function (response) {
      const { data: res } = response
      console.log(res)
    });
}
const registerFunc = function () {
  proxy.$axios.post(baseURL + '/login', user)
    .then(function (response) {
      const { data: res } = response
      console.log(res)
    });
}

</script>

